Skip to content

Conversation

Nalon
Copy link
Collaborator

@Nalon Nalon commented Oct 1, 2025

Summary

This PR modernizes the Hardhat 2 starter kit to work with the unvendored layout in @chainlink/[email protected] and documents a way to use Solidity import remappings in HH2 via hardhat-preprocessor.

What changed

  • Upgrade @chainlink/contracts to v1.5.0
  • Add hardhat-preprocessor and a small helper to rewrite Solidity imports based on a remappings.txt. Wire it into hardhat.config.js via preprocess.
  • Update staging tests to the new ABI paths introduced by [email protected] (e.g., vrf/VRFCoordinatorV2_5.abi.json, shared/LinkToken.abi.json).
  • Add a Remapping section to the README explaining what remappings are, how HH2 handles them with hardhat-preprocessor, and a warning that it’s a third-party plugin.
  • Link to the Hardhat 3 branch for HH3 SK.
  • Make remappings.txt more explicit by pointing each alias to its node_modules location (clearer for newcomers even though HH2 already searches node_modules).
  • Add comments to remappings-helper.js to explain how the loader and preprocessor hook work.

Why

  • @chainlink/[email protected] un-vendors several packages and changes import locations; without remapping, HH2 users hit broken imports or long relative paths. Remapping keeps imports clean & resilient.

Nalon added 4 commits October 1, 2025 14:36
The recent release of [email protected] unvendors a number of contracts. 1.5.0 utilizes remappings to resolve the import paths for these dependency packages.
- Upgraded to @chainlink/[email protected]
- Added helper js file to handle remappings using hardhat-preprocessor
- Added remappings.txt that contains remappings
- Updated hardhat.config.js to include remapping preprocessor
- Updated README to include remapping section, warning of third party plugin, and a link to the HH3 branch
- Updated remappings.txt to specify the node_modules directory for each remapping. This is not required as hardhat 2 searched the node_modules directory for external libraries by default. However, including it allows developers to better understand exactly what is happeng (or where the remapping is going to).
@Nalon Nalon requested a review from thodges-gh October 2, 2025 07:01
Copy link
Contributor

@zeuslawyer zeuslawyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Note: I've pushed a small commit on top of your branch to improve alerting for end users to the remapping concept.
Also minor comment on version pinning in package.json

Copy link
Contributor

@zeuslawyer zeuslawyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@zeuslawyer zeuslawyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zeuslawyer zeuslawyer requested review from thodges-gh and removed request for andrejrakic and thodges-gh October 7, 2025 02:19
@thodges-gh thodges-gh merged commit 2c39ac8 into smartcontractkit:main Oct 7, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants